// Mixin 钩子按照传入顺序依次调用，并在调用组件自身的钩子之前被调用。
const tableHeight = {
  data() {
    return {
      maxTableHeight: null
    }
  },
  created() {
    this.diffDocumentHeight()
  },
  mounted() {
    window.addEventListener('resize', this.diffDocumentHeight)
  },
  methods: {
    diffDocumentHeight() {
      this.$nextTick(() => {
        const searchHeight = this.$refs.search.$el.offsetHeight + 16
        this.maxTableHeight =  document.body.clientHeight - 50 - 40 - searchHeight - 52 - 80
      })
      
    }
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.diffDocumentHeight)
  }
}

export default tableHeight